import { currentShape } from '../../../data/shapes';
import { LIBRARY_ENUM } from '@/enum/system';

export const fileSelectorConfig = ref({
  type: LIBRARY_ENUM.IMAGE,
  show: false,
});

export const setMediaSrc = (url: string) => {
  if (url) {
    console.log(currentShape.value);
    if (currentShape.value.type === 'video') {
      currentShape.value.src = url;
    } else {
      currentShape.value.cacheSrc = url;
    }
  }
};

export const setImage = () => {
  fileSelectorConfig.value.type = LIBRARY_ENUM.IMAGE;
  fileSelectorConfig.value.show = true;
};

export const setVideo = () => {
  fileSelectorConfig.value.type = LIBRARY_ENUM.VIDEO;
  fileSelectorConfig.value.show = true;
};
